<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>实验室助理工作管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/font.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/css/xadmin.css}">
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script type="text/javascript" th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <input type="hidden" name="repairId" th:value="${repairId}" lay-verify="repairId">
            <div class="layui-form-item">
                <label for="equipmentName" class="layui-form-label">
                    <span class="x-red">*</span>设备名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="equipmentName" name="equipmentName" th:value="${repair.equipmentName}" required="required" lay-verify="equipmentName"
                           autocomplete="off"
                           class="layui-input"></div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="equipmentNo" class="layui-form-label">
                    <span class="x-red">*</span>设备编号</label>
                <div class="layui-input-inline">
                    <input type="text" id="equipmentNo" name="equipmentNo" th:value="${repair.equipmentNo}" required="required" lay-verify="equipmentNo"
                           autocomplete="off"
                           class="layui-input"></div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="errorContent" class="layui-form-label">
                    <span class="x-red">*</span>故障描述</label>
                <div class="layui-input-inline">
                    <input type="text" id="errorContent" name="errorContent" th:value="${repair.errorContent}" required="required" lay-verify="errorContent"
                           autocomplete="off"
                           class="layui-input"></div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="repairTime" class="layui-form-label">
                    <span class="x-red">*</span>报修时间</label>
                <div class="layui-input-inline">
                    <input type="date" id="repairTime" name="repairTime" th:value="${repair.repairTime}" required="required" lay-verify="repairTime"
                           autocomplete="off"
                           class="layui-input"></div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <button type="submit" class="layui-btn" lay-filter="add" lay-submit="">提交</button>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(['form', 'layer', 'jquery'],
        function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;

            //监听提交
            form.on('submit(add)',
                function (data) {
                    //console.log(data);
                    $.ajax({
                        type: "post",
                        url: "http://localhost:9527/sysLab/assistantRepair/assistantRepairEdit",
                        async: false,
                        dataType: 'json',
                        data: {
                            repairId: data.field.repairId,
                            equipmentName: data.field.equipmentName,
                            equipmentNo: data.field.equipmentNo,
                            errorContent: data.field.errorContent,
                            repairTime: data.field.repairTime
                        },
                        success: function (res) {
                            //console.log("======" + res.data);
                            if (res.data == "success") {
                                //console.log("enter ==>")
                                layer.alert("修改成功", {
                                        icon: 6
                                    },
                                    function() {
                                        //关闭当前frame
                                        xadmin.close();

                                        // 可以对父窗口进行刷新
                                        xadmin.father_reload();
                                    });
                            } else {
                                layer.alert("服务出错！", {
                                    icon: 6
                                });
                            }
                        },
                        error: function (res) {
                            layer.alert("修改失败", {
                                icon: 6
                            });
                        }
                    })
                    return false;
                });
        });
</script>

</body>

</html>
